
Set VERSION=%1%
set JOB_TYPE=CURRENT
set PROJECTPATH=C:\Workspace\Robot\space
Set EXECUTION_FOLDER=C:\Workspace\Robot\space\Cases
Set TANGOPROJECT=C:\Workspace\Robot\tango
set TANGO_LIB_FOLDER=C:\Workspace\Robot\tango\lib
set LOGDIR=C:\Workspace\Log\Space\%VERSION%

Set RUN_ARG1=--skip BLOCK --listener %TANGO_LIB_FOLDER%\tango_robotframework\;%LOGDIR%\allure_log
Set RUN_ARG2=--removekeywords PASSED --maxerrorlines 10
Set RUN_ARG3=-d %LOGDIR%

echo Create Log Folder %LOGDIR%\allure_log and %LOGDIR%\ErrorJpg
IF EXIST %LOGDIR% ( rd/s /q %LOGDIR% )
mkdir %LOGDIR%\allure_log
mkdir %LOGDIR%\ErrorJpg


echo ***************************************************************
echo           Step1:Execute Case
echo ***************************************************************
cd %PROJECTPATH%
python -m robot %RUN_ARG1% %RUN_ARG2% %RUN_ARG3% -o output1.xml %EXECUTION_FOLDER%
python -m robot %RUN_ARG1% %RUN_ARG2% %RUN_ARG3% -R %LOGDIR%/output1.xml -o output2.xml %EXECUTION_FOLDER%
python -m robot.rebot %RUN_ARG3% -r ReportLevel2.html -l LogLevel2.html --suitestatlevel 2 -o output.xml --merge %LOGDIR%/*xml


echo ***************************************************************
echo           Step2:Upload Robot result to Linux
echo ***************************************************************
cd %LOGDIR%
cd ..
winrar a -r %VERSION%.zip .\%VERSION%
echo Generate %VERSION%.zip
cd %TANGOPROJECT%\Execution\window
call batApiUtil.bat uploadSpaceLog "'%VERSION%','%JOB_TYPE%','C:\Workspace\Log\Space\\%VERSION%.zip'"
echo Upload to Linux